package com.cweb.framework.generator.gen.bean;

import cn.hutool.core.util.StrUtil;
import lombok.Data;

/**
 * 代码生成对象
 */
@Data
public class GeneratorFile {
    private String name;
    private String path;
    private String content;
    public GeneratorFile(String path, String content) {
        this.path = path;
        this.content = content;
        // 文件名
        if (StrUtil.isNotBlank(this.path)){
            int index = this.path.lastIndexOf("/");
            if(index == -1) { index = this.path.lastIndexOf("\\"); }
            if(index != -1){ this.name = this.path.substring(index + 1); }
        }
    }
}
